home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-22 | 1.1 KB | 27 lines | [TEXT/CCL ] |
- ;;; Prints contents of HNET. Dan Suthers.
-
- (in-package :HNET)
-
- (export 'print-hnet-below-root)
-
- (defun PRINT-HNET-BELOW-ROOT (hnet root
- &optional
- (to-depth most-positive-fixnum)
- (to-stream *standard-output*))
- "print-hnet-below-root <hnet> <root>"
- (check-type hnet symbol)
- (check-type root symbol)
- (check-type to-depth integer)
- (check-type to-stream stream)
- (assert (sm:gets 'hnet hnet) (hnet) "[PRINT-HNET-BELOW-ROOT] Unknown hnet.")
- (assert (defined-p root hnet) (root) "[PRINT-HNET-BELOW-ROOT] Unknown root.")
- (labels ((printer (frontier depth)
- (when (and frontier (< depth to-depth))
- (dolist (term frontier)
- (declare (symbol term))
- (format to-stream "~%")
- (dotimes (x depth) (format to-stream " "))
- (format to-stream "~S" term)
- (printer (subordinates term hnet) (1+ depth))))))
- (printer (list root) 0)
- hnet))